﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;
using mvcDemo.App_Code;
using Webdiyer.WebControls.Mvc;

namespace mvcDemo.Models
{
    public class ValidationModel
    {
        //public static List<Models.UserModel> GetList(string StrUserName, int PageSize, int CurrentCount, out int TotalCount);
        //public static IQueryable<TElement> AsQueryable<TElement>(this IEnumerable<TElement> source);
        //public static PagedList<T> ToPagedList<T>(this IQueryable<T> allItems, int pageIndex, int pageSize);
        //方法一
        //-------------------------------------------------------
        //[Display(Name="特殊数字")]
        //[Required(ErrorMessage="请输入{0}")]
        //[StringLength(20, ErrorMessage = "{0}在{2}位至{1}位之间", MinimumLength = 1)]
        //方法二
        //-------------------------------------------------------
        //[RegularExpression(@"^[0-5]*$", ErrorMessage = "只能输入0-5间的数字")]
        //第一个参数为要验证的正则表达式，第二个参数为错误消息  
        //-------------------------------------------------------
        [SpecialValidation]//等效方法二，用一个类去继承RegularExpressionAttribute
        public string InputNumber { get; set; }
    }
    public class UserModel
    {
        public int UserID { get; set; }                 //用户编号
        public string UserName { get; set; }            //用户名
        public string Password { get; set; }            //密码
        public int Sex { get; set; }                    //性1女
        public int Age { get; set; }                    //年龄
        public int Political { get; set; }              //政治面貌
        public int Height { get; set; }                 //身高
        public int Weight { get; set; }                 //体重
        public string Graduated { get; set; }           //毕业院校
        public string Professional { get; set; }        //专业
        public DateTime GraduatedDate { get; set; }     //毕业日期
        public string Address { get; set; }             //现住地址
        public string Phone { get; set; }               //联系电话
        public string ImagePath { get; set; }           //头相地址
        public string Other { get; set; }               //其他描述
    }
    //以页面为主的用户登陆模型
    public class LoginModelNew
    {
        public string UserName { get; set; }            //用户名
        public string Password { get; set; }            //密码
    }
    //以页面为主的用户注册模式
    public class RegeditModel
    {
        public string UserName { get; set; }            //用户名
        public string Password { get; set; }            //密码
        public int Sex { get; set; }                    //性别
        public int Age { get; set; }                    //年龄
    }
}